//商品
(function(){
	var db_table_name = "goods";
	var db = require("../db/index");
	//构造函数
	var _con = function (info,bus_id){
		var self = this;
		//商品编号
		self._id = "G_"+Math.random().toString(16).substr(2)+(+new Date).toString(16);
		//操作记录
		self._his = [];
		//额外信息
		self.info = info;
		//所属商家ID
		self.bus_id = bus_id;

		db.insert(db_table_name,self);
		// console.log("生产了一个商品：",info.name);
	};
	//技能
	_con.prototype = require("./skill");
	module.exports = _con;
	//静态方法
	_con.get = function(Id){
		var result = db.find_by_id(db_table_name,Id);
		if(result){
			result.__proto__ = _con.prototype;
		}
		return result;
	}
}());